/**
 * Copyright (c) Software Institute of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.transformation.editor.views.figures;

import org.eclipse.draw2d.Border;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FlowLayout;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;

/**
 * @generated
 * 
 */
public class NormalRuleFigure extends RuleFigure {
	private Figure expArea = new Figure();
	private Figure varArea = new Figure();
	public NormalRuleFigure() {

		XYLayout layout = new XYLayout();
		setLayoutManager(layout);
		setBackgroundColor(this.backgroundColor);
		this.add(nameArea);
		nameArea.setLocation(new Point(0, 0));
		
		varArea.setLayoutManager(new FlowLayout(false));
		
		this.add(varArea);
		Border b = new MarginBorder(5, 0, 0, 0);
		expArea.setLayoutManager(new FlowLayout(false));
		expArea.setBorder(b);
		this.add(expArea);

	}

	@Override
	public void setBounds(Rectangle rect) {
		super.setBounds(rect);
		nameArea.setSize(rect.width, nameArea.getPreferredSize().height);
		varArea.setLocation(new Point(rect.x + rect.width / 8, nameArea.getLocation().y + nameArea.getSize().height + 10));
		varArea.setSize(varArea.getPreferredSize());
		expArea.setLocation(new Point(rect.x + rect.width / 8, varArea.getBounds().y+varArea.getPreferredSize().height));
		expArea.setSize(expArea.getPreferredSize());
	}

	public Figure getExpressionArea() {
		return expArea;

	}
	public Figure getVariableArea() {
		return varArea;
	}
	public void addVariable(String s) {
		Label l = new Label(s);
		varArea.add(l);
	}
}
